<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1330){h=_rate*1330;}
var _img=['home-t1.jpg'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('./img/'+_img[i]);}
loader.start();
loader.addCompletionListener(function(e){
<?php if ($hasQian){ ?>
$(".p5").fadeIn(800).css({"opacity":1});
<?php }else{  ?>
$(".home").fadeIn(800).css({"opacity":1});
<?php } ?>   
});
var _gpLat=_gpLong='';
var geolocation = new qq.maps.Geolocation("ZIHBZ-P5ICQ-OA55T-GVXOP-BPX4O-QUBHE", "myapp");
var options = {timeout: 8000, failTipFlag:true};
function showErr(){
	
}
function showPosition(position){
	_gpLat=position.lat;
	_gpLong=position.lng;
	var _dizhi=position.province+position.city+position.addr;
	$.post("./api/?c=setuser", {lat:_gpLat,lon:_gpLong,dizhi:_dizhi}, function(data){}, "json");
}
$(function(){
	document.body.addEventListener('touchmove', function (e) {
		  e.preventDefault();  
	}, {passive: false});
	$('.container').width(sWidth).height(h);
	$('.p-b').width(sWidth).height(_rate*1330);
	$('.home-t1').height(_rate*590);
	$('#home-phone').width(_rate*376).height(_rate*64).css({'line-height':_rate*64+'px',"top":_rate*393, "left":_rate*186});
	$('.home-qren').width(_rate*240).height(_rate*90).css({"top":_rate*480, "left":_rate*260});

	$('.p2-t2').width(_rate*634).height(_rate*234).css({"top":_rate*316});
	$('.p2-z1').css({"top":_rate*306, "left":_rate*150});
	$('.p2-z2').width(_rate*386).height(_rate*64).css({'line-height':_rate*64+'px',"top":_rate*44, "left":_rate*182});
	$('.p2-z3').width(_rate*386).height(_rate*64).css({'line-height':_rate*64+'px',"top":_rate*134, "left":_rate*182});
	$('.wan-t2').css({"top":_rate*364});
	$('.wan-z2').css({"top":_rate*454});

	$('.p5-t1').width(_rate*390).height(_rate*90).css({"top":_rate*342, "left":_rate*180});
	$('.p5-t2').width(_rate*390).height(_rate*90).css({"top":_rate*458, "left":_rate*180});
	$('.p5-t3').width(_rate*390).height(_rate*90).css({"top":_rate*562, "left":_rate*180});

	
	
	

	function _popMsg(msg){
		$(".weui-msg").html(msg);
        $("#loadingToast").show();
        window.setTimeout(function(){
        	$("#loadingToast").hide();
            }, 1400);
    }

	var nId=3;
	function _goNextP(){
	   if(nId < 1){
		 $(".wan").fadeOut();
		 $(".p5").fadeIn();
         return;
	   }
       $(".wan-z2").html("即将进入下一页（"+nId+"s）");
       nId--;
       window.setTimeout(function(){
    	   _goNextP();
           }, 1000);
    }
	$('.p5-t1').click(function(){
        window.location.href="https://mei94.com/meeting/p.php?id=1&op=<?php echo $openid ?>";
	});
	$('.p5-t2').click(function(){
        window.location.href="https://mei94.com/meeting/p.php?id=2&op=<?php echo $openid ?>";
	});
	$('.p5-t3').click(function(){
        window.location.href="https://mei94.com/meeting/p.php?id=3&op=<?php echo $openid ?>";
	});
	$('.home-qren').click(function(){
		var _phone=$("#home-phone").val();
		console.log(1111);
        if('' == _phone){
        	_popMsg("请您输入手机号");
            return;  
        }
        if('' == _gpLat){
          wx.getLocation({
        	  type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
        	  success: function (res) {
        		_gpLat=res.latitude;
          	    _gpLong=res.longitude;
        	  }
        	});
          return;
        }
		$.post("./api/?c=user", {phone:_phone,lat:_gpLat,lon:_gpLong}, function(data){
			if('n' == data.s){
	        	_popMsg("您输入的信息不存在");
	            return;  
	        }
	         $(".p2-z1").html("尊敬的"+data.n+"，");
			 $(".home").fadeOut();
			 $(".wan").fadeIn(function(){
				 _goNextP();
		     });
			 
		}, "json");

    });
	
	
	$('.arw').width(_rate*41).height(_rate*46).css({"left":_rate*354});


	 wx.config({
	        appId: '<?php echo $signPackage["appId"];?>',
	        timestamp: <?php echo $signPackage["timestamp"];?>,
	        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
	        signature: '<?php echo $signPackage["signature"];?>',
	        jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'showMenuItems', 'hideMenuItems','getLocation']
	    });
	    wx.ready(function () {
	    		var _title='结大义，谋大利';
	    		var _desc='2021中国区代理运营商闭门会议';
	    		var _link='http://mei94.com/meeting/';
	    		var _imgUrl='http://mei94.com/meeting/img/6.jpg';
	    			wx.updateAppMessageShareData({
	    			    title: _title, 
	    			    desc: _desc, 
	    			    link: _link, 
	    			    imgUrl: _imgUrl, 
	    			    success: function () {
	    			    }
	    			  })
	    			 wx.updateTimelineShareData({ 
	                      title: _desc, 
	                      link: _link, 
	                      imgUrl: _imgUrl, 
	                      success: function () {
	                      }
	                    })
                     
                     /**
                    wx.getLocation({
                    	  type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
                    	  success: function (res) {
                    	    var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                    	    var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
                    	    _gpLat=res.latitude;
                    	    _gpLong=res.longitude;
                    	  }
                    	});
                    	*/
                    

	    });

	    geolocation.getLocation(showPosition, showErr, options);
	
});
</script>